<?php
/**
 * Created by PhpStorm.
 * User: zhangligang
 * Date: 17/4/22
 * Time: 下午2:17
 */

namespace App\Http\Models;

use Illuminate\Database\Eloquent\Model;

/**
 * 订单
 * Class Order
 * @package App\Http\Models
 */
class Order extends Model
{
    /**
     * table name
     * @var string
     */
    protected $table = 'app_order';

    protected $fillable = ['*'];

    /**
     * 关联订单商品
     * @return \Illuminate\Database\Eloquent\Relations\HasMany
     */
    public function orderGoods()
    {
        return $this->hasMany('App\Http\Models\OrderGoods', 'order_id', 'id');
    }

    /**
     * 关联买家
     * @return \Illuminate\Database\Eloquent\Relations\BelongsTo
     */
    public function buyer()
    {
        return $this->belongsTo('App\Http\Models\User', 'buyer_id');
    }

}